UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K/OWaumvCeF2Q23jEjH0XqeCDpid2vGlX5n2mdCgH2M=' 
WHERE 
  key_id = '7f7b9a8061a201c9838d5498eb38cedd544d55a791c2f16fbff21cbaa74e33e5' 
  AND (
    token = 'K/OWaumvCeF2Q23jEjH0XqeCDpid2vGlX5n2mdCgH2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042