UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'La3G+VFrWHv0o0rJFqFBOn9/Rnct+fISiuHzB3jv9ic=' 
WHERE 
  key_id = '829cc60b80aca6fc167bc6a3f73ea2f13d68b99cab681456ce61e092b7228189' 
  AND (
    token = 'La3G+VFrWHv0o0rJFqFBOn9/Rnct+fISiuHzB3jv9ic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032