UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TA6htZpj6xXXTDtm2OKMEnoSM7l5P+CTlclrtAxgpXo=' 
WHERE 
  key_id = '23ff0ab322592d9b4a38dd5b2b18927a3108369f684928015decef27239f6d75' 
  AND (
    token = 'TA6htZpj6xXXTDtm2OKMEnoSM7l5P+CTlclrtAxgpXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031