UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WEw3olYoI9raqpfXvyAhIWiMqGZOjcbkwPmeOjdutXs=' 
WHERE 
  key_id = '746fc1ece1dc3a315af3b27155794dab3e1dadb7e0f9079e06432c80f2036022' 
  AND (
    token = 'WEw3olYoI9raqpfXvyAhIWiMqGZOjcbkwPmeOjdutXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022