UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KZu2K/VjQadzODH2AE1NP+J0xlPwJ8I7BQ9BSBuUNNc=' 
WHERE 
  key_id = '8ac687d687ffadc671dce50e91523767aa3db681bb6a7410a3f1352e05859085' 
  AND (
    token = 'KZu2K/VjQadzODH2AE1NP+J0xlPwJ8I7BQ9BSBuUNNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027