UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BIg2/YaidUkLUzjhYmMq3yRsUGQc2UwuTrPVUxOOCAU=' 
WHERE 
  key_id = '314e8cc7626ff893ef654e8a093804e4ac4df29d98fb2abbae6ba7a97944d8bc' 
  AND (
    token = 'BIg2/YaidUkLUzjhYmMq3yRsUGQc2UwuTrPVUxOOCAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021