UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mHVv74+f5uRPk4wV0IEqSH/AyXhIz5mawzPCUr36Euc=' 
WHERE 
  key_id = '4685e958cbe65d6fe806c0f03582a88c1cdadf39e774f63785c819a91e0fcd07' 
  AND (
    token = 'mHVv74+f5uRPk4wV0IEqSH/AyXhIz5mawzPCUr36Euc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022