UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '49gSDtm2/suKySD9JB3RqoDSI+Tjyhgu640eMn7S85I=' 
WHERE 
  key_id = 'ffe9c8b7f1a2e2164582144068e0ea5ef700b8f11889c6645a60ee0f876be1d9' 
  AND (
    token = '49gSDtm2/suKySD9JB3RqoDSI+Tjyhgu640eMn7S85I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037