UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OsAwk6gLbtEJPNqiqNAG1FZmVQrux2eTnih12kSQGqw=' 
WHERE 
  key_id = '4339541a9f57421086714597f8b406793d438a2a0424279d7c5a6962091d7317' 
  AND (
    token = 'OsAwk6gLbtEJPNqiqNAG1FZmVQrux2eTnih12kSQGqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057