UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PCA8vwZJVIXyvYRTIFW64DOq6VJC7e1R5p6prhS9PjI=' 
WHERE 
  key_id = '17d4742e64362d18ea87e92bb7f1f8a89a1d2c1dd8cc191c2b112c879047894e' 
  AND (
    token = 'PCA8vwZJVIXyvYRTIFW64DOq6VJC7e1R5p6prhS9PjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047