UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a4wnlNL40NvQPGcHSr53iT4wqGGcB7dsVh7flfUWXL4=' 
WHERE 
  key_id = '819b7b4848ecdac907e871aa14ffe8c5e782481a162f0ca81846a137de38e0df' 
  AND (
    token = 'a4wnlNL40NvQPGcHSr53iT4wqGGcB7dsVh7flfUWXL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016