UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a1grEEYcwAsyOfA7muozUkNDZylqy56qXrT8bWOvEQ0=' 
WHERE 
  key_id = '23c111635b380f1c3e6707875e6393ff4f95e5ca34f4b6c8c82e7f2f61915bf7' 
  AND (
    token = 'a1grEEYcwAsyOfA7muozUkNDZylqy56qXrT8bWOvEQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017