UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lt67Nxc+vhwYhDG8SQlHIiiQsCConxgoDGJLaEcuwho=' 
WHERE 
  key_id = 'c72387214d359091c957692c304dd6d6c4c551d2b03276f676a67fa7564ba66d' 
  AND (
    token = 'lt67Nxc+vhwYhDG8SQlHIiiQsCConxgoDGJLaEcuwho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024