UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YpEFLFBW3W5pLf76V4xrkc73uJgkaOSwfPrniPmidVs=' 
WHERE 
  key_id = 'c56063c8c7398c2572b480ffec69ad71004cf6679daeea3b60249b130ea835c9' 
  AND (
    token = 'YpEFLFBW3W5pLf76V4xrkc73uJgkaOSwfPrniPmidVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040