UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Us0Nd/AOuxm1PB3b4IfT/AUY5+dZ84MOoLfNC+TrWAs=' 
WHERE 
  key_id = '53eee276ffe31cc02d8ff2b6f4b46cca543b5eae6874966b8bb18d398312b0f4' 
  AND (
    token = 'Us0Nd/AOuxm1PB3b4IfT/AUY5+dZ84MOoLfNC+TrWAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016