UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TRIUlK+LkBVJbOjqyaOwKED5r2ixA3dtblqy0MnBmps=' 
WHERE 
  key_id = 'd54ed13fecaf382f4a093dbb752b410069b043aed3ee8fb04b9370b1830ddd2b' 
  AND (
    token = 'TRIUlK+LkBVJbOjqyaOwKED5r2ixA3dtblqy0MnBmps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022