UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cPDOILsoQPRJhllpXF7ClyCGmbaOpnrjlG+YyWlf378=' 
WHERE 
  key_id = 'a09de885b43d786294771b15b76bd51f1005c5ae51f907545b0aedb76f83d9e5' 
  AND (
    token = 'cPDOILsoQPRJhllpXF7ClyCGmbaOpnrjlG+YyWlf378=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029