UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dRfoSJx8COzhC/DSfBLCn4Ps4iADerzTYm6ahD8UM7M=' 
WHERE 
  key_id = 'e7c9c1b454502afb74b10b9d9db0d3eb607987cef4facaf2e1584b814a1f62a5' 
  AND (
    token = 'dRfoSJx8COzhC/DSfBLCn4Ps4iADerzTYm6ahD8UM7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054