UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's23Pj8mQRE6WaiRWIVX/CkPOobpwLVfoaUChAuoc+EQ=' 
WHERE 
  key_id = 'fe5a947ee4b97fb65f44c039b52faa7c258460dfd4da096ed45ac73712e4aba3' 
  AND (
    token = 's23Pj8mQRE6WaiRWIVX/CkPOobpwLVfoaUChAuoc+EQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038