UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PNSHkg6D4IFJcabBFKu9bJ3qrzlk1d+Q/ED9fcvlzkc=' 
WHERE 
  key_id = '14af731bdbf592bd096e92c5fc30de3450ef4e271ca2139716a66124728abfe0' 
  AND (
    token = 'PNSHkg6D4IFJcabBFKu9bJ3qrzlk1d+Q/ED9fcvlzkc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038