UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WjC25PcPDymEQppOyn+vm3oLzSGk1tytXhPrgGqokYY=' 
WHERE 
  key_id = 'eb775e17494c3391c054a4484d7e01b9be6254a572af740779492efb2d504d19' 
  AND (
    token = 'WjC25PcPDymEQppOyn+vm3oLzSGk1tytXhPrgGqokYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040