UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ua1lH5qP0Po3CluSSg6UlzooFHQ5uPg1RM2eC09hWmE=' 
WHERE 
  key_id = '843474bdb957f8b0b6dca0e24a3a770ba3566176796c60ae014321379eaa8112' 
  AND (
    token = 'Ua1lH5qP0Po3CluSSg6UlzooFHQ5uPg1RM2eC09hWmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051