UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWclXMRH0A5O7+PDjJ6OEEUlPn/RdkLQrlYnusEa3P8=' 
WHERE 
  key_id = '02d2237876bcef68459e798b330694751211d687bd250c94191047c1ffeb3e9c' 
  AND (
    token = 'YWclXMRH0A5O7+PDjJ6OEEUlPn/RdkLQrlYnusEa3P8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00396