UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8nHm0ZZaP1cuoJSnaUNBFHNp04OSc8yCYA2XczovlKI=' 
WHERE 
  key_id = '6941165402fe8574b45e503b47a47545d348801be4d123d37a5032568a7c4f81' 
  AND (
    token = '8nHm0ZZaP1cuoJSnaUNBFHNp04OSc8yCYA2XczovlKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026