UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G/poFfDsM4FuXxlVeB2tRQyakihxB0JK+jrUQElC9aw=' 
WHERE 
  key_id = 'a828fa25178f267eacda5216ca007ad214117c93ee7479d02b2e1eadff190099' 
  AND (
    token = 'G/poFfDsM4FuXxlVeB2tRQyakihxB0JK+jrUQElC9aw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042