UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7q/+rj405cVWBvw4vc7eHZJpwfs47kEYQ9H4ZniP30g=' 
WHERE 
  key_id = '2c3849ec01587d7d10465153b50fc8c0f56e392c7d4c70154e14cc85642e2cdc' 
  AND (
    token = '7q/+rj405cVWBvw4vc7eHZJpwfs47kEYQ9H4ZniP30g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024