UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tA7YgSINkPYthB3xZTxf+iVb9PhSXy9m+S1asMMO6OU=' 
WHERE 
  key_id = 'b42bf5e1407e0fba88bb28f3ddc153e6f0218a5393519ca30e823d5c11447e20' 
  AND (
    token = 'tA7YgSINkPYthB3xZTxf+iVb9PhSXy9m+S1asMMO6OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032