UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tpwScvp38Uuz8ogULdDUcR2gERuW21CRXkw2EV8AGh8=' 
WHERE 
  key_id = '54ff7932373696f6b3491774f0e558fd22bfe083f5759c74cebce36d6606cedd' 
  AND (
    token = 'tpwScvp38Uuz8ogULdDUcR2gERuW21CRXkw2EV8AGh8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048